import request from '@/utils/request'

// 查询公寓楼信息列表
export function list(query) {
  return request({
    url: '/dorm/house/list',
    method: 'get',
    params: query
  })
}

// 导出公寓楼信息列表
export function exportList(query) {
  return request({
    url: '/dorm/house/export',
    method: 'post',
    data: query
  })
}


// 获取公寓楼信息详细信息
export function getHouseInfoById(query) {
  return request({
    url: '/dorm/house/' + query.houseId,
    method: 'post',
    data: query
  })
}


// 新增公寓楼信息
export function addHouse(query) {
  let arr = []
  query.userHouseListId.map(es => {
    arr.push({
      userId: es
    })
  })

  delete query.userHouseListId
  query.userHouseList = arr
  return request({
    url: '/dorm/house/addhouse',
    method: 'post',
    data: query
  })
}


// 修改公寓楼信息
export function putHouseInfoById(query) {
  let arr = []
  query.userHouseListId.map(es => {
    arr.push({
      userId: es
    })
  })

  delete query.userHouseListId
  query.userHouseList = arr
  return request({
    url: '/dorm/house/update',
    method: 'put',
    data: query
  })
}


// 删除公寓楼信息
export function delHouseInfoById(query) {
  return request({
    url: '/dorm/house/delete/' + query.houseIds,
    method: 'DELETE',
  })
}



// 查询宿舍楼全部
export function getHouseAllList(query) {
  return request({
    url: 'dorm/house/list?pageSize=1000&pageNum=1',
    method: 'get',
    params:query
  })
}

// 查询宿舍楼的树结构
export function allInfolist(query) {
  return request({
    url: 'dorm/house/allInfolist',
    method: 'get',
    params:query
  })
}


// 查询宿舍楼的树结构
export function getSysUser(query) {
  return request({
    url: '/system/user/search',
    method: 'get',
    params:query
  })
}
// 查询公寓楼电费编号信息
export function houseList(query) {
  return request({
    url: '/dorm/house/kd/list',
    method: 'get',
    params:query
  })
}
// 修改公寓楼电费编号信息
export function houseEdit(query) {
  return request({
    url: '/dorm/house/kd/edit',
    method: 'put',
    data:query
  })
}


